/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.mobiubiq.directory.client.object.io;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import org.mobiubiq.directory.client.object.AbstractObject;
import org.mobiubiq.directory.client.object.BarcodeObject;

/**
 *
 * @author Marnix Renne
 */
public class BarcodeObjectReaderWriter implements ObjectReaderWriter {

    public void write(AbstractObject object, DataOutputStream outputStream) throws IOException {
        BarcodeObject barcode = (BarcodeObject) object;
        outputStream.writeUTF(barcode.getBarcode());
    }

    public AbstractObject read(DataInputStream inputStream) throws IOException {
        BarcodeObject result = new BarcodeObject();
        result.setBarcode(inputStream.readUTF());
        return result;
    }
}
